<template>
	<view>
		<u-navbar title="合成记录" :fixed="true" :placeholder="true" :safeAreaInsetTop="true" :autoBack="false"
			leftIconColor="#666" titleStyle="color:#333" bgColor="transparent" 
			@leftClick="leftClick"></u-navbar>
			<view class="wrap" v-for="(item,index) in zoneList" :key="item.id">
				<view class="time">
					合成时间：{{item.create_time}}
				</view>
				<view class="item" v-for="itm in item.synthetic_goods" :key="itm.id" >
					<image :src="itm.goods_image" mode=""></image>
					<text>{{itm.goods_name}}</text>
				</view>
				<view class="btn" v-if="item.receive_status==0" @click="sub(item.id)">
					领取
				</view>
				<image src="../../static/image/xhd.png" class="bg" mode="" v-if="item.new_status==1&&item.receive_status==0" ></image>
				<image class="sy" src="/static/image/ysy.png" mode="" v-if="item.receive_status==1"></image>
			</view>
			<noDatas :xxxList="zoneList" :status="status"></noDatas>
			<u-popup :show="show" mode="center" @close="show=false" closeable bgColor="transparent">
				<view class="zz_wrap">
					<view class="tit">
						请输入领取奖励的账号信息
					</view>
					<view class="ipt">
						<input type="text"  v-model.trim="account1" placeholder="请输入领取账号"   />
					</view>
					<view class="ipt">
						<input type="number" v-model.trim="phone1" placeholder="请输入领取手机号" />
					</view>
					<view class="zz_btn" @click="submit">
						确认
					</view>
			
				</view>
			</u-popup>
	</view>
</template>

<script>
	import {activityList,record,receives} from '../../api/other.js'
	export default {
		data() {
			return {
				page: 1,
				size: 10,
				status: 'loadmore', //加载前值为loadmore，加载中为loading，没有数据为nomore
				zoneList: [],
				show:false,
				account1:"",
				phone1:"",
				hid:""
			}
		},
		onLoad() {
			this.initList()
		},
		methods: {
			submit(){
				receives({
					id:this.hid,
					account:this.account1,
					phone:this.phone1
				}).then(res=>{
					if(res.code==1){
						this.account1=""
						this.phone1=""
						this.show=false
						this.page=1
						this.initList()
					}
					uni.$u.toast(res.msg)
				})
			},
			sub(id){
				this.hid=id
				this.show=true
				
			},

			leftClick() {
				const canNavBack = getCurrentPages()
				console.log(canNavBack.length);
				if (canNavBack.length > 1) {
					uni.navigateBack({
						delta: 1
					})
				} else {
					uni.switchTab({
						url: '/pages/index/index'
					})
				}
			},
			initList() {
				console.log(this.brandId);
				let data = {
					page: this.page,
				};
				record(data).then(res => {
					console.log(res);
					if (res.code == 1) {
						let list = res.data.data;
						this.zoneList = this.page == 1 ? list : this.zoneList.concat(list);
						console.log(this.zoneList);
						if (list.length < this.size) this.status = 'nomore';
						else this.status = 'loading';
					}
				})
			},
			goDetail(id){
				uni.navigateTo({
					url:'/pagesMy/debris/debrisdetail?id='+id
				})
			}
		},
		// 下拉刷新
		onPullDownRefresh() {
			console.log('下拉刷新');
			let that = this;
			setTimeout(function() {
				that.page = 1
				that.zoneList = []
				that.initList()
			}, 800);
		},
		//触底加载
		onReachBottom() {
			console.log('触底加载');
			if (this.status != 'nomore') {
				this.page = this.page + 1
				this.initList()
			}
		}
	}
</script>

<style scoped lang="scss">
.wrap{
	width: 690rpx;
	// height: 230rpx;
	background: #F2F2F2;
	border-radius: 12rpx 12rpx 12rpx 12rpx;
	margin: 0 auto;
	margin-top: 20rpx;
	padding-bottom: 20rpx;
	position: relative;
}
.time{
	font-weight: 400;
	font-size: 30rpx;
	color: #666666;
	padding-top: 28rpx;
	margin-left: 24rpx;
}
.item{
	position: relative;
	display: flex;
	align-items: center;
	width: 500rpx;
	>image{
		width: 100rpx;
		height: 100rpx;
		border-radius: 24rpx 24rpx 24rpx 24rpx;
		margin-left: 24rpx;
	}
	>text{
		width: 400rpx;
		font-size: 28rpx;
		color: #3D3D3D;
		line-height: 32rpx;
		margin-left: 10rpx;
		 white-space: nowrap;       /* 不允许换行 */
		  overflow: hidden;          /* 隐藏超出的文本 */
		  text-overflow: ellipsis;   /* 用省略号表示超出的文本 */
	}
}
.btn{
	width: 138rpx;
	height: 54rpx;
	background: #A68A64;
	border-radius: 374rpx 374rpx 374rpx 374rpx;
	position: absolute;
	bottom: 36rpx;
	right: 48rpx;
	font-weight: 400;
	font-size: 30rpx;
	color: #FFFFFF;
	text-align: center;
	line-height: 54rpx;
	z-index: 9;
}
.bg{
	width: 114rpx;
	height: 118rpx;
	position: absolute;
	top: 0;
	right: 0;
}
.sy{
	width: 152rpx;
	height: 146rpx;
	position: absolute;
	bottom: 0;
	right: 0;
}
	.zz_wrap {
		width: 602rpx;
		// height: 416rpx;
		background: #E0DDDA;
		border-radius: 22rpx 22rpx 22rpx 22rpx;
	
		.tit {
			width: 602rpx;
			text-align: center;
			font-size: 36rpx;
			color: #333;
			padding-top: 50rpx;
	
		}
	
		.ipt {
			width: 522rpx;
			height: 76rpx;
			background: #f2f2f2;
			border-radius: 410rpx 410rpx 410rpx 410rpx;
			margin: 0 auto;
			margin-top: 62rpx;
	
			>input {
				width: 502rpx;
				height: 76rpx;
				background: #f2f2f2;
				border-radius: 410rpx 410rpx 410rpx 410rpx;
				padding-left: 20rpx;
				font-size: 30rpx;
				color: #333;
			}
		}
	
		.zz_btn {
			width: 522rpx;
			height: 76rpx;
			background: linear-gradient( 90deg, #AB8E68 0%, #D7BA93 100%);
			border-radius: 410rpx 410rpx 410rpx 410rpx;
			border-radius: 410rpx 410rpx 410rpx 410rpx;
			margin: 0 auto;
			margin-top: 50rpx;
			margin-bottom: 62rpx;
			font-weight: 300;
			font-size: 30rpx;
			color: #FFFFFF;
			text-align: center;
			line-height: 76rpx;
		}
	
		.otherinfo {
			width: 522rpx;
			// height: 400rpx;
			padding-bottom: 40rpx;
			margin: 0 auto;
			margin-top: 48rpx;
	
			.otherinfo_tit {
				font-size: 28rpx;
				color: #333;
			}
	
			.otherinfowrap {
				width: 522rpx;
				height: 200rpx;
				position: relative;
				margin: 0 auto;
	
				>image {
					width: 100rpx;
					height: 100rpx;
					border-radius: 50%;
					margin-top: 46rpx;
				}
	
				.othername {
					width: 300rpx;
					height: 38rpx;
					font-family: Source Han Sans, Source Han Sans;
					font-weight: 400;
					font-size: 26rpx;
					color: #333;
					position: absolute;
					top: 34rpx;
					left: 128rpx;
				}
	
				.otherphone {
					width: 300rpx;
					height: 38rpx;
					font-family: Source Han Sans, Source Han Sans;
					font-weight: 400;
					font-size: 26rpx;
					color: #333;
					position: absolute;
					top: 80rpx;
					left: 128rpx;
				}
	
				.otherphone2 {
					width: 300rpx;
					height: 38rpx;
					font-family: Source Han Sans, Source Han Sans;
					font-weight: 400;
					font-size: 26rpx;
					color: #333;
					position: absolute;
					top: 124rpx;
					left: 128rpx;
				}
	
				.othernum {
					margin-top: 20rpx;
					font-size: 24rpx;
					color: #D7D6E1;
					white-space: nowrap;
					/* 不换行 */
					overflow: hidden;
					/* 超出部分隐藏 */
					text-overflow: ellipsis;
	
				}
			}
	
			.other_btnwrap {
				width: 522rpx;
				height: 72rpx;
				display: flex;
				justify-content: space-between;
				align-items: center;
				margin-top: 70rpx;
	
				.other_btn1 {
					width: 220rpx;
					height: 72rpx;
					border-radius: 280rpx 280rpx 280rpx 280rpx;
					border: 2rpx solid #A68A64;
					font-size: 28rpx;
					color: #333;
					text-align: center;
					line-height: 72rpx;
				}
	
				.other_btn2 {
					width: 220rpx;
					height: 72rpx;
					background: linear-gradient( 274deg, #F9A569 0%, #F94A49 100%);
					border-radius: 280rpx 280rpx 280rpx 280rpx;
					font-size: 28rpx;
					color: #333;
					text-align: center;
					line-height: 72rpx;
				}
			}
		}
	}
</style>